package org.example.springbookdamo.Service;

import org.example.springbookdamo.Dao.BookDao;
import org.example.springbookdamo.model.Bookinfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


import java.util.List;


@Service
public class BookService {
    @Autowired private BookDao bookDao;
    public List<Bookinfo> getlist() {
        //理应从数据库中查询，为学习数据库相关操作
        //BookDao bookDao = new BookDao();
        List<Bookinfo> bookinfos = bookDao.mockData();
        for (Bookinfo bookinfo : bookinfos) {
            if (bookinfo.getStatus()==1 ) {
                bookinfo.setStatusCN("可借阅");
            }else {
                bookinfo.setStatusCN("不可借阅");
            }
        }
        return bookinfos;
    }


}
